import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;

public class demo2_2 {
    public static void main(String[] args) throws ParserConfigurationException, IOException, SAXException {
        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder documentBuilder=documentBuilderFactory.newDocumentBuilder();
        Document doc=documentBuilder.parse("src/demo2.xml");
        NodeList list=doc.getElementsByTagName("pubDate");
        Element pubDateElement=(Element) list.item(0);
        String pubDate=pubDateElement.getFirstChild().getNodeValue();
        System.out.println(pubDate);
    }
}
